<template>
    <div>
<h1>医生显示</h1>
<table class="table">
    <thead>
        <tr>
            <td>编号</td>
            <td>医生名称</td>
            <td>头像</td>
            <td>所属科室</td>
            <td>创建日期</td>
        </tr>
    </thead>
    <tbody>
   <tr v-for="d in data">
            <td>{{d.did}}</td>
            <td>{{d.doctorName}}</td>
            <td><img :src="'https://localhost:7258/'+d.imgUrl" style="width: 60px;height: 60px;"></td>
            <td>{{d.kName}}</td>
            <td>{{moment(d.createdate).format("YYYY-MM-DD")}}</td>
        </tr>
    </tbody>
</table>
当前{{datapsa.pageIndex}}页  显示{{datapsa.pageSize}}条  一共{{dataas.count}}条 一共{{dataas.list}}页
<input type="button" value="首页" @click="page(1)">
<input type="button" value="上一页" @click="page(datapsa.pageIndex-1)">
<input type="button" v-for="d in dataas.list" :value="d" @click="Dao(d)">
<input type="button" value="下一页" @click="page(datapsa.pageIndex+1)">
<input type="button" value="尾页" @click="page(dataas.list)">
<select v-model="datapsa.pageSize" @change="Yrl">
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="5">5</option>
    <option value="8">8</option>
</select>
<input type="text" v-model="datapsa.pageIndex"> <input type="button" value="跳转" @click="Tz">
    </div>
</template>

<script setup lang="ts">
import { ref,onMounted } from 'vue';
import moment from 'moment';
import axios from 'axios';
onMounted(()=>{
    GetShows();
})
const datapsa=ref({
    pageIndex:1,
    pageSize:2,
})
const data=ref([{
       "kid": 1,
      "kName": "内科",
      "did": 2,
      "kids": 1,
      "doctorName": "string",
      "createdate": "2025-05-19T09:53:23.3741593",
      "imgUrl": "string"
}])
const dataas=ref({
    count:0,
    list:0
})

const GetShows=()=>{
    axios.get("/api/Doctor/GetDoctor",{params:datapsa.value}).then(res=>{
        data.value=res.data.list;
        dataas.value.count=res.data.count;
        dataas.value.list=Math.ceil(dataas.value.count/datapsa.value.pageSize);
    })
}
//翻页
const page=(e:any)=>{
if(e>=1&&e<=dataas.value.list)
{
    datapsa.value.pageIndex=e;
    GetShows();
}
}
//页容量
const Yrl=()=>{
    GetShows();
}
//跳转
const Tz=()=>{
    GetShows();
}

const Dao=(e:any)=>{
    datapsa.value.pageIndex=e;
    GetShows();
}

</script>

<style scoped>

</style>